import Mock from 'mockjs';
import { baseApi } from '@/server/base'
import { getBodyParams, getUrlParams } from '@/mock/utils';

import { TagInfo } from '@/apis/tag';


export default [
  {
    url: `${baseApi}/team/list`,
    type: 'get',
    response: (params?: any) => {
      return Mock.mock({
        code: 1,
        'data|20': [
          {
            id: '@id',
            name: '@word(5)',
            type: '标注|清洗|审批',
            explain: '@word(10,15)',
          }
        ],
        msg: ''
      })
    }
  },
  {
    url: /\/apis\/label\/removeById\/.*/,
    type: 'delete',
    response: (params: any) => {
      const { id } = getUrlParams(params.url);
      return Mock.mock({

        code: 1,
        data: {
          id,
          name: '@word(5)',
          colour: '@color',
          createTime: '@datetime',
        },
        msg: ''
      })
    }
  },
  {

    url: `${baseApi}/tag/save`,

    type: 'post',
    response: (params: any) => {
      const _params = getBodyParams(params.body);
      return Mock.mock({

        code: 1,
        data: _params,
        msg: ''
      })
    }
  },
  {
    url: `${baseApi}/tag/update`,
    type: 'put',
    response: (params: any) => {
      const _params = getBodyParams(params.body);
      return Mock.mock({
        code: 1,
        data: _params,
        msg: ''
      })
    }
  }
]
